package Poker;

import java.util.*;

public class PokerDemo {
    public static void main(String[] args) {
        HashMap<Integer, String> hm = new HashMap<Integer, String>();
        ArrayList<Integer> array = new ArrayList<Integer>();
        String[] colours = {"♠", "♣", "♥", "♦"};
        String[] numbers = {"3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K", "A", "2"};
        int index = 0;
        for (String number : numbers) {
            for (String colour : colours) {
                hm.put(index, colour + number);
                array.add(index);
                index++;
            }
        }
        hm.put(index, "小王");
        array.add(index);
        index++;
        hm.put(index, "大王");
        array.add(index);
        Collections.shuffle(array);
        TreeSet<Integer> zwqset = new TreeSet<Integer>();
        TreeSet<Integer> zwqset2 = new TreeSet<Integer>();
        TreeSet<Integer> zwqset3 = new TreeSet<Integer>();
        TreeSet<Integer> dpset = new TreeSet<Integer>();
        for (int i = 0; i < array.size(); i++) {
            int x = array.get(i);
            if (i > array.size() - 3) {
                dpset.add(x);

            } else if (i % 3 == 0) {
                zwqset.add(x);
            } else if (i % 3 == 1) {
                zwqset2.add(x);
            } else if (i % 3 == 2) {
                zwqset3.add(x);
            }
        }
        lookPoker("hanser",zwqset,hm);
        lookPoker("hanser2",zwqset2,hm);
        lookPoker("hanser3",zwqset3,hm);
        lookPoker("dipai",dpset,hm);
      /*  for(String colour:colours){
            for(String number:numbers){
                array.add(colour+number);
            }
        }
        array.add("小王");
        array.add("大王");
        Collections.shuffle(array);
    //    System.out.println(array);
        ArrayList<String>  zwqArray=new ArrayList<String>();
        ArrayList<String>  fgyArray=new ArrayList<String>();
        ArrayList<String>  wjyArray=new ArrayList<String>();
        ArrayList<String>  dpArray=new ArrayList<String>();
        for(int i=0;i< array.size();i++){
            String poker = array.get(i);
            if(i> array.size()-3){
                dpArray.add(poker);
            }else  if(i%3==0){
                zwqArray.add(poker);
            }else if(i%3==1){
                fgyArray.add(poker);
            }else if(i%3==2){
                wjyArray.add(poker);
            }

        }
        lookPoker("朱文卿",zwqArray);
        lookPoker("冯高远",fgyArray);
        lookPoker("吴佳宇",wjyArray);
        lookPoker("底牌",dpArray);

        }
    public static  void lookPoker(String name,ArrayList<String> array){
        System.out.print(name+"的牌是:");
        for(String poker:array){
            System.out.print(poker+" ");
        }
        System.out.println();
    }
}
*/
    }
    public  static  void lookPoker(String name,TreeSet<Integer> ts,HashMap<Integer,String> hm){
        System.out.print(name+"的牌是");
        for(Integer key: ts){
            String poker=hm.get(key);
            System.out.print(poker+" ");
        }
        System.out.println(" ");
    }
}